<?php

/**
 * Class representing main menu
 *
 * @author Honza
 */
class Menu {

  /**
   * 
   * @return string html representing menu
   */
  public static function getMenu() {
    $menu = "";
    if (isset($_GET['where'])) {
      $where = $_GET['where'];
    } else {
      $where = "";
    }

    $menu .= "<ul id=\"menu\">";
//put class="current" in the li tag for the selected page - to highlight which page you're on
    $menu .= "<li";
    $menu .= ($where === 'home' || $where === "") ? " class=\"current\"" : "";
    $menu .= "><a href=\"index.php?where=home\">Home</a></li>";
    $menu .= "<li";
    $menu .= ($where === 'about') ? " class=\"current\"" : "";
    $menu .= "><a href=\"index.php?where=about\">About us</a></li>";
    $menu .= "<li";
    $menu .= ($where === 'activities') ? " class=\"current\"" : "";
    $menu .= "><a href=\"index.php?where=activities\">Activities</a></li>";
    $menu .= "<li";
    $menu .= ($where === 'catalog') ? " class=\"current\"" : "";
    $menu .= "><a href=\"index.php?where=catalog\">Catalog</a></li>";
    $menu .= "<li";
    $menu .= ($where === 'contact') ? " class=\"current\"" : "";
    $menu .= "><a href=\"index.php?where=contact\">Contact us</a></li>";

    $auth = Auth::getInstance();
    if ($auth->hasAuthority(ROLE_EMPLOYEE)) {
      //entrance to employee section
      $menu .= "<li id=\"zamestnanecMB\"";
      $menu .= ($where === 'employee') ? " class=\"current\"" : "";
      $menu .= "><a href=\"index.php?where=employee\">Employee</a></li>";
    }

    if ($auth->hasAuthority(ROLE_ADMIN)) {
      //entrance to administration section
      $menu .= "<li id=\"adminMB\"";
      $menu .= ($where === 'admin') ? " class=\"current\"" : "";
      $menu .= "><a href=\"index.php?where=admin\">Administration</a></li>";
    }
    
    $menu .= "</ul>";

    return $menu;
  }

}

?>
